package com.example.springboot.controller;

import com.example.springboot.dto.CodeGeneratorDto;
import com.example.springboot.utils.AjaxResult;
import com.example.springboot.utils.CodeGeneratorNew;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
public class CodeGeneratorController {


    @RequestMapping(value = "/generator",method= RequestMethod.POST)
    public AjaxResult generatorCode(@RequestBody CodeGeneratorDto codeGenerator){
        try{
            CodeGeneratorNew.generateAll(codeGenerator);
            return AjaxResult.success("生成成功！");
        }catch (Exception e){
            e.printStackTrace();
            return AjaxResult.failure("请查看日志");
        }

    }

}
